<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
		<head>
			<!-- template designed by Marco Von Ballmoos  -->
			<title>File Source for index.php</title>
			<link rel="stylesheet" href="../media/stylesheet.css" />
											</head>
		<body>
						<h1>Source for file index.php</h1>
<p>Documentation is available at <a href="../default/_ays_index_php.html">index.php</a></p>
<div class="src-code">
<pre><ol><li><a name="a1"></a><span class="src-php">&lt;?php</span></li>
<li><a name="a2"></a><span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/get_magic_quotes_gpc">get_magic_quotes_gpc</a><span class="src-sym">(</span><span class="src-sym">))</span><span class="src-sym">{ </span><span class="src-key">die</span><span class="src-sym">(</span><span class="src-str">'Magic Quotes activated.'</span><span class="src-sym">)</span><span class="src-sym">; </span><span class="src-sym">}</span></li>
<li><a name="a3"></a>&nbsp;</li>
<li><a name="a4"></a><a href="http://www.php.net/ob_start">ob_start</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a5"></a><a href="http://www.php.net/session_start">session_start</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a6"></a><a href="http://www.php.net/header">header</a><span class="src-sym">(</span><span class="src-str">'Content-type: text/html; charset=UTF-8'</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a7"></a>&nbsp;</li>
<li><a name="a8"></a><span class="src-comm">/* Manage language session */</span></li>
<li><a name="a9"></a><span class="src-key">if</span><span class="src-sym">(</span><span class="src-sym">!</span>isset<span class="src-sym">(</span><span class="src-var">$_COOKIE</span><span class="src-sym">[</span><span class="src-str">'lang'</span><span class="src-sym">]</span><span class="src-sym">) </span>|| <span class="src-sym">!</span>isset<span class="src-sym">(</span><span class="src-var">$_SESSION</span><span class="src-sym">[</span><span class="src-str">'lang'</span><span class="src-sym">]</span><span class="src-sym">))</span><span class="src-sym">{</span></li>
<li><a name="a10"></a>    <span class="src-var">$_SESSION</span><span class="src-sym">[</span><span class="src-str">'lang'</span><span class="src-sym">] </span>= <a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><a href="http://www.php.net/strtolower">strtolower</a><span class="src-sym">(</span><span class="src-var">$_SERVER</span><span class="src-sym">[</span><span class="src-str">'HTTP_ACCEPT_LANGUAGE'</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-num">2</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a11"></a><span class="src-sym">}</span></li>
<li><a name="a12"></a>&nbsp;</li>
<li><a name="a13"></a><span class="src-comm">/* 'dev' or 'prod' */</span></li>
<li><a name="a14"></a><a href="http://www.php.net/define">define</a><span class="src-sym">(</span><span class="src-str">'APP_USE_TYPE'</span><span class="src-sym">, </span><span class="src-str">'prod'</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a15"></a>&nbsp;</li>
<li><a name="a16"></a><a href="http://www.php.net/error_reporting">error_reporting</a><span class="src-sym">(</span><span class="src-id">E_ALL</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a17"></a><a href="http://www.php.net/date_default_timezone_set">date_default_timezone_set</a><span class="src-sym">(</span><span class="src-str">'Europe/Paris'</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a18"></a>&nbsp;</li>
<li><a name="a19"></a><span class="src-comm">// Include of configuration file</span></li>
<li><a name="a20"></a><span class="src-inc">require_once </span><span class="src-id">dirname</span><span class="src-sym">(</span>__FILE__<span class="src-sym">)</span>.<span class="src-str">'/config/config.php'</span><span class="src-sym">;</span></li>
<li><a name="a21"></a>&nbsp;</li>
<li><a name="a22"></a><span class="src-inc">require_once </span><span class="src-id">WEBAPP_DIR</span>.<span class="src-str">'/application/function/protectScript.php'</span><span class="src-sym">;</span></li>
<li><a name="a23"></a><span class="src-inc">require_once </span><span class="src-id">WEBAPP_DIR</span>.<span class="src-str">'/application/function/displayContentArray.php'</span><span class="src-sym">;</span></li>
<li><a name="a24"></a>&nbsp;</li>
<li><a name="a25"></a><span class="src-comm">// Inclusion des classes et initialisation</span></li>
<li><a name="a26"></a><span class="src-inc">require_once </span><span class="src-id">MODEL_DIR</span>.<span class="src-str">'/Mysqli.php'</span><span class="src-sym">;</span></li>
<li><a name="a27"></a>try<span class="src-sym">{</span></li>
<li><a name="a28"></a>    <span class="src-var">$oMysqliInstance </span>= <span class="src-id"><a href="../default/AYSMysqli.html">AYSMysqli</a></span><span class="src-sym">::</span><a href="../default/AYSMysqli.html#methodgetInstance">getInstance</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a29"></a><span class="src-sym">}</span>catch<span class="src-sym">(</span><span class="src-id"><a href="../default/MysqliConnexionException.html">MysqliConnexionException</a> </span><span class="src-var">$oException</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a30"></a>    <span class="src-var">$oException</span><span class="src-sym">-&gt;</span><span class="src-id">addLog</span><span class="src-sym">(</span><span class="src-str">'MysqliConnexion'</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a31"></a>    <span class="src-var">$sMessage </span>= <span class="src-var">$oException</span><span class="src-sym">-&gt;</span><span class="src-id">getMessage</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a32"></a>    <span class="src-inc">include_once </span><span class="src-id">VIEW_DIR</span>.<span class="src-str">'/errors.php'</span><span class="src-sym">;</span></li>
<li><a name="a33"></a>    <span class="src-key">die</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a34"></a><span class="src-sym">}</span></li>
<li><a name="a35"></a>&nbsp;</li>
<li><a name="a36"></a><a href="http://www.php.net/set_include_path">set_include_path</a><span class="src-sym">(</span></li>
<li><a name="a37"></a>    <span class="src-str">'.'</span>.</li>
<li><a name="a38"></a>    <span class="src-id">PATH_SEPARATOR</span>.</li>
<li><a name="a39"></a>    <span class="src-id"><a href="../default/_ays_config_config_php.html#defineMODEL_DIR">MODEL_DIR</a></span>.</li>
<li><a name="a40"></a>    <span class="src-id">PATH_SEPARATOR</span>.</li>
<li><a name="a41"></a>    <a href="http://www.php.net/get_include_path">get_include_path</a><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a42"></a><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a43"></a>&nbsp;</li>
<li><a name="a44"></a><span class="src-inc">require_once </span><span class="src-id">WEBAPP_DIR</span>.<span class="src-str">'/application/Exceptions/ExceptionsList.php'</span><span class="src-sym">;</span></li>
<li><a name="a45"></a>&nbsp;</li>
<li><a name="a46"></a><span class="src-comm">/* Display */</span></li>
<li><a name="a47"></a><span class="src-inc">include_once </span><span class="src-id">CONTROLLER_DIR</span>.<span class="src-str">'/headerController.php'</span><span class="src-sym">;</span></li>
<li><a name="a48"></a>&nbsp;</li>
<li><a name="a49"></a>try<span class="src-sym">{</span></li>
<li><a name="a50"></a>    <span class="src-key">if</span><span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$_GET</span><span class="src-sym">[</span><span class="src-str">'page'</span><span class="src-sym">]</span><span class="src-sym">) </span><span class="src-key">AND </span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$_GET</span><span class="src-sym">[</span><span class="src-str">'page'</span><span class="src-sym">]</span><span class="src-sym">))</span><span class="src-sym">{</span></li>
<li><a name="a51"></a>        <span class="src-var">$sPage </span>= <span class="src-var">$_GET</span><span class="src-sym">[</span><span class="src-str">'page' </span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a52"></a>        <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/file_exists">file_exists</a><span class="src-sym">(</span><span class="src-id"><a href="../default/_ays_config_config_php.html#defineCONTROLLER_DIR">CONTROLLER_DIR</a></span>.<span class="src-str">'/'</span>.<span class="src-var">$sPage</span>.<span class="src-str">'Controller.php'</span><span class="src-sym">))</span><span class="src-sym">{</span></li>
<li><a name="a53"></a>            <span class="src-inc">include_once </span><span class="src-id">CONTROLLER_DIR</span>.<span class="src-str">'/'</span>.<span class="src-var">$sPage</span>.<span class="src-str">'Controller.php'</span><span class="src-sym">;</span></li>
<li><a name="a54"></a>        <span class="src-sym">}</span><span class="src-key">else</span><span class="src-sym">{</span></li>
<li><a name="a55"></a>            throw <span class="src-key">new </span><span class="src-id"><a href="../default/PageNotFoundException.html">PageNotFoundException</a></span><span class="src-sym">(</span></li>
<li><a name="a56"></a>                <span class="src-str">'Désolé, la page demandée n\'existe pas. L\'administrateur a été prévenu.'</span><span class="src-sym">,</span></li>
<li><a name="a57"></a>                <span class="src-id"><a href="../default/_ays_application_Exceptions_ExceptionsList_php.html#defineERROR">ERROR</a></span></li>
<li><a name="a58"></a>            <span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a59"></a>        <span class="src-sym">}</span></li>
<li><a name="a60"></a>    <span class="src-sym">}</span><span class="src-key">else</span><span class="src-sym">{</span></li>
<li><a name="a61"></a>        <span class="src-inc">include_once </span><span class="src-id">CONTROLLER_DIR</span>.<span class="src-str">'/homeController.php'</span><span class="src-sym">;</span></li>
<li><a name="a62"></a>        <span class="src-inc">include_once </span><span class="src-id">CONTROLLER_DIR</span>.<span class="src-str">'/newsController.php'</span><span class="src-sym">;</span></li>
<li><a name="a63"></a>    <span class="src-sym">}</span></li>
<li><a name="a64"></a><span class="src-sym">}</span>catch<span class="src-sym">(</span><span class="src-id"><a href="../default/PageNotFoundException.html">PageNotFoundException</a> </span><span class="src-var">$oException</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a65"></a>    <span class="src-var">$oException</span><span class="src-sym">-&gt;</span><span class="src-id">addLog</span><span class="src-sym">(</span><span class="src-str">'PageNotFound'</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a66"></a>    <span class="src-var">$sMessage </span>= <span class="src-var">$oException</span><span class="src-sym">-&gt;</span><span class="src-id">getMessage</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a67"></a>    <span class="src-inc">include_once </span><span class="src-id">VIEW_DIR</span>.<span class="src-str">'/errors.php'</span><span class="src-sym">;</span></li>
<li><a name="a68"></a><span class="src-sym">}</span>catch<span class="src-sym">(</span><span class="src-id">Exception </span><span class="src-var">$oException</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a69"></a>    <span class="src-var">$oException</span><span class="src-sym">-&gt;</span><span class="src-id">addLog</span><span class="src-sym">(</span><span class="src-str">'Exception'</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a70"></a>    <span class="src-var">$sMessage </span>= <span class="src-var">$oException</span><span class="src-sym">-&gt;</span><span class="src-id">getMessage</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a71"></a>    <span class="src-inc">include_once </span><span class="src-id">VIEW_DIR</span>.<span class="src-str">'/errors.php'</span><span class="src-sym">;</span></li>
<li><a name="a72"></a><span class="src-sym">}</span></li>
<li><a name="a73"></a>&nbsp;</li>
<li><a name="a74"></a>&nbsp;</li>
<li><a name="a75"></a><span class="src-inc">include_once </span><span class="src-id">CONTROLLER_DIR</span>.<span class="src-str">'/footerController.php'</span><span class="src-sym">;</span></li>
<li><a name="a76"></a>&nbsp;</li>
<li><a name="a77"></a><span class="src-comm">// Closing current connexion with database</span></li>
<li><a name="a78"></a><span class="src-var">$oMysqliInstance</span><span class="src-sym">-&gt;</span><span class="src-id">close</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a79"></a>&nbsp;</li>
<li><a name="a80"></a><a href="http://www.php.net/ob_end_flush">ob_end_flush</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a81"></a><span class="src-php">?&gt;</span></li>
</ol></pre>
</div>
	<p class="notes" id="credit">
		Documentation generated on Sun, 30 Mar 2008 00:13:52 +0100 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.3.0RC3</a>
	</p>
	</body>
</html>